<template>
  <a-dropdown :trigger="['click']">
    <a class="ant-dropdown-link" @click.prevent>
      更多
      <DownOutlined />
    </a>
    <template #overlay>
      <div style="background-color: white; border: 2px solid #f5f8f9">
        <!--        <a-button type="link" @click="cli_edit(record)">编辑</a-button>-->
        <!--        <br/>-->
        <a-button v-if="paritm.key !== '-2'" type="link" @click="cli_add(record)">新增子项</a-button>
        <br v-if="paritm.key !== '-2'" />
        <a-button type="link" @click="cli_person(record)">关联人员</a-button>
        <br />
        <a-button type="link" @click="cli_pms(record)">关联权限</a-button>
        <br />
        <a-button type="link" danger @click="cli_delete(record)">删除</a-button>
      </div>
    </template>
  </a-dropdown>
</template>
<script>
import { defineComponent } from 'vue'
import { DownOutlined } from '@ant-design/icons-vue'

export default defineComponent({
  components: {
    DownOutlined,
  },
  props: {
    record: { type: Object, default: () => {} },
    paritm: {
      type: Object,
      default: () => {
        key: '-1'
      },
    },
  },
  emits: ['cli_edit', 'cli_add', 'cli_person', 'cli_pms', 'cli_delete'],
  setup(_, ctx) {
    const cli_edit = (record) => {
      ctx.emit('cli_edit', record)
    }
    const cli_add = (record) => {
      ctx.emit('cli_add', record)
    }
    const cli_person = (record) => {
      ctx.emit('cli_person', record)
    }
    const cli_pms = (record) => {
      ctx.emit('cli_pms', record)
    }
    const cli_delete = (record) => {
      ctx.emit('cli_delete', record)
    }
    return {
      cli_edit,
      cli_add,
      cli_person,
      cli_pms,
      cli_delete,
    }
  },
})
</script>
